package main

import (
	"fmt"
	"go_jwt/controller"
	"go_jwt/initializer"
	"go_jwt/middleware"

	"github.com/gin-gonic/gin"
)

func init() {
	initializer.LoadEnvVariables()
	initializer.ConnectToDb()
	initializer.SyncDatabase()
}

func Ping(c *gin.Context) {
	c.JSON(200, gin.H{
		"message": "pong11",
	})
}

func main() {

	fmt.Println("Hello, world!")

	r := gin.Default()
	r.GET("/ping", Ping)

	r.POST("/signup", controller.SignUp)
	r.POST("/login", controller.Login)
	r.GET("/validate", middleware.RequireAuth, controller.Validate)

	r.Run()
}
